package com.usian.ai.controller;

import com.usian.ai.common.Result;
import com.usian.ai.service.FileOssService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2024 12 09 15 09
 **/

@RestController
@RequestMapping("/file")
@Slf4j

@CrossOrigin
public class FileController {

    @Autowired
    FileOssService fileOssService;


    @PostMapping("/uploadToOss")
    public Result uploadToOss(@RequestParam("file") MultipartFile file)
    {
        String s = fileOssService.uploadToOss(file);
        return Result.ok(s);
    }
}
